Skip to main content

User Creation and Inquiry

Create a User

This document outlines the process for creating users within the SDK, specifically for tenant administrators and standard users. It details the required parameters for user creation, the roles available, and provides examples of how to create both tenant administrators and users using the SDK. Additionally, it includes instructions for retrieving all users associated with a tenant.

Parameters:

ParameterTypeRequiredDescription
user_nameStringYesA unique username for the user
emailStringYesThe user's email address
passwordStringYesThe password for the user's account
first_nameStringYesThe user's first name
last_nameStringYesThe user's last name
rolesListYesA list of roles to assign (["Administrator"] or ["User"])
tenant_idIntegerYesThe ID of the tenant to which the user will be associated
analytics_idListYesA list of analytics IDs the user should have access to

User Roles

RoleDescription
AdministratorFull access, typically for tenant administrators
UserLimited access, typically for standard users

Creating a Tenant Admin

To create a tenant administrator, use the following function:

addTenantAdmin = sdk.create_user(

user_name="Cody Solomon",

email="Admin@eizen.ai",

password="1234",

first_name="Cody",

last_name="Solomon",

roles=["Administrator"],

tenant_id=1,

analytics_id=[1]

)

print(addTenantAdmin)

Creating a Tenant User

To create a standard user for the tenant, use the following function:

addTenantUser = sdk.create_user(

user_name="Cody Solomon",

email="User@eizen.ai",

password="1234",

first_name="Cody",

last_name="Solomon",

roles=["User"],

tenant_id=1,

analytics_id=[1]

)

print(addTenantUser)

Notes

  • roles: A list of roles to assign (either "Administrator" or "User").
  • tenant_id: Must be a valid tenant ID that the current user has access to.
  • analytics_id: A list of analytics IDs the user should have access to.
  • A password is required.

Get All Users:

To retrieve all users within the tenant, use the following template:

getUsers = sdk.get_all_users()

print(getUsers)

Notes

  • Ensure that the SDK is initialized properly with a valid User token before invoking these methods.
  • All returned data is typically formatted as a dictionary or list.